1. Field of the Invention
The present invention relates a method for compensating timing errors of real-time clocks.
2. Description of the Related Art
As shown in FIG. 1, a minimum unit of real-rime clocks is “second”, which principle is to divide a 32768 Hz square wave, which is an output frequency of a crystal oscillator, into 1 Hz square waves. The 1 Hz square waves generate the unit of time “second” and calendar logic circuits. Accordingly, calendar logics of minute, hour, day, month, and week are generated. The output standard frequency of the crystal oscillator is 32768 Hz; however, errors of the output frequency of the crystal oscillator always exist due to the changes of temperature and manufacturing errors of the quartz crystals.
Generally, the output frequency of the crystal oscillator is compared with the relative errors of the standard frequency 32768 Hz for deriving an error measuring standard, as the expression shown, the unit is PPM (Parts Per Million).
  ERR  =                    f        -        32768            32768        *          10      6        ⁢    PPM  
In present technology, the errors between the output frequency of the crystal oscillator and the standard frequency 32768 Hz are usually compensated by means of making compensations on the relative errors at regular times. According to the regular times, for example, find out the clock numbers of compensation that need to be compensated in accordance with the relative errors (ERR) and change the value of the frequency dividing counter (CNT) in every 10 seconds. As shown in FIG. 2, while the compensation is executed at every 10 seconds, 10 seconds, which means the total numbers of the frequency dividing counter and the clock numbers of reference frequency to be 32768*10=327680. Therefore, the 10-seconds frequency dividing counter CNT adding 1 is equal to a compensation of +3 PPM to the reference frequency. The frequency dividing counter CNT which fails to add one time is equal to a compensation of −3 PPM to the reference frequency. In general, the sampling frequency of ERR is 0.1 Hz, the ERR effective value of compensatory data is 3 PPM, the maximum errors after the compensation is 1.5 PPM.
The low of the sampling frequency of ERR derived by the compensatory method at regular times is, the high the effective value of the compensatory data is. However, the low sampling frequency causes aliasing errors of frequency spectrum. As a result, the sampling frequency of ERR attained by the method aforementioned cannot be too high and low. A contradictory relationship exists between the sampling frequency apparatus of ERR and the last compensatory accuracy.